<?php
class OrderRequest{
	public $mode, $name, $company, $address1, $address2, $city, $state, $postalcode, $country, $shipping_description;
	public $products;
	public $response_type;
	
	function OrderRequest($test = false){
		$this->response_type = 'OrderResponse';
		if($test){
			$this->mode = 'TEST';
		}
		else{
			$this->mode = 'LIVE';
		}
	}
	
	function getXML(){
		
		ob_start(); 
		?>
<Order>
	<UserId><?php echo $GLOBALS['konaki_user'];?></UserId>
	<Password><?php echo $GLOBALS['konaki_pass'];?></Password>
	<Mode><?php echo $this->mode;?></Mode>
	<Name><?php echo $this->name;?></Name>
	<Company><?php echo $this->company;?></Company>
	<Address1><?php echo $this->address1;?></Address1>
	<Address2><?php echo $this->address2;?></Address2>
	<City><?php echo $this->city;?></City>
	<State_Province><?php echo $this->state;?></State_Province>
	<PostalCode><?php echo $this->postalcode;?></PostalCode>
	<Country><?php echo $this->country;?></Country>
	<ShippingDescription><?php echo $this->shipping_description;?></ShippingDescription>
	<?php
	foreach($this->products as $product){
	   		?>
			<Product>
				<ProductId><?php echo $product->product_id; ?></ProductId>
				<Quantity><?php echo $product->quantity; ?></Quantity>
			</Product>
	   		<?php
	   	}
	?>
</Order> 	
	<?php
		$xml = ob_get_contents();
		ob_end_clean();
		return $xml;
	}
}
?>
